//
//  SandBox.m
//  UILesson_18_1SandBox(沙盒机制)
//
//  Created by lanou3g on 16/1/14.
//  Copyright © 2016年 DH. All rights reserved.
//

#import "SandBox.h"

@implementation SandBox

// 获取Documents的文件目录
+ (NSString *)getDocumentsDirectory{
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
    return documentPath;
}

// 获取library的文件目录
+ (NSString *)getLibraryDirectory{
    NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    return libraryPath;
}

// 获取library/Ceches的文件路径
+ (NSString *)getCachesDirectory{
    NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
    return cachesPath;
}

// 获取library/preferences的文件路径
+ (NSString *)getPreferencesDirectory{
    NSString *preferencesPath = [NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSUserDomainMask, YES) firstObject];
    return preferencesPath;
}

// 获取tmp的文件路径
+ (NSString *)getTmpDirectory{
    NSString *tmpPath = NSTemporaryDirectory();
    return tmpPath;
}

// 获取xxx.app的文件路径
+ (NSString *)getAppBundlePath{
    NSString *appPath = [[NSBundle mainBundle] resourcePath];
    return appPath;
}

@end
